package com.twu.biblioteca.medias;

import com.twu.biblioteca.medias.CantUnlockAnUnlockedException;

/**
 * Created by mderaldo on 9/25/14.
 */
public abstract class Medias {
    protected String title;
    protected int code;
    protected int year;
    protected boolean locked;

    public abstract String getDetails();

    public boolean isLocked(){
        return locked;
    }

    public void lock(){
        if(locked){
            throw new CantLockAnLockedException();
        } else {
            locked = true;
        }
    }

    public String getSummary(){
        return "Cod: " + code + " | Title: "+ title;
    }

    public int getCode(){
        return code;
    }
}
